﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OWINServer
{
    /// <summary>
    /// 保存接口收到的信息，并用事件触发的方式将收到的接口信息通知桌面应用
    /// </summary>
    public class OWINTriggerEvent
    {
        public delegate void IncomingCallEventHandler(object sender, EventArgs e);
        public event IncomingCallEventHandler incomingEvent;

        public delegate void CommunicateStatusEventHandler(object sender, EventArgs e);
        public event CommunicateStatusEventHandler statusEvent;

        // 存储信息变量
        public string Message = "";

        /// <summary>
        /// 编写引发事件的函数(在程序任意域使用)
        /// </summary>
        public void OnMessage()
        {
            if (incomingEvent != null)
            {
                // 发送信息
                incomingEvent(this, new EventArgs());
            }
        }

        /// <summary>
        /// 通话状态通知方法
        /// </summary>
        public void OnStatus()
        {
            if(statusEvent != null)
            {
                // 通话状态
                statusEvent(this, new EventArgs());
            }
        }
    }
}
